/**
 * 滚动到底部加载更多
 */
(function(g, $){
    function scroller(){
        var isEnd = false;
        var isProcessing = false;        
        var _self = this;
        this.curPage = 1;
        this.run = function(){
            $(window).scroll(function(){
                if(isEnd == true || isProcessing == true) return;
                if ($(document).height() - $(this).scrollTop() - $(this).height() < 100){
                    _self.block();
                    _self.render(_self.curPage);
                }
            });
        };
        // 渲染当前页面
        this.render = function(cpage){

        };
        this.block = function(){
            isProcessing = true;
        };
        this.unblock = function(){
            isProcessing = false;
        };
        this.done = function(){
            isEnd = true;
        };
        this.isDone = function(){
            return isEnd;
        };
		this.isBlock = function(){
			return isProcessing;
		};
		// 请求第一页时候重置
		this.reset = function(){
			isEnd = false;
			isProcessing = false;
			_self.curPage = 1;
		};
    }
    g.jqScroller = new scroller();
})(window, jQuery);